\(\int \frac {\cos (x)}{2-3 \sin (x)+\sin ^2(x)} \, dx\) [16]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 15, antiderivative size = 17 \[ \int \frac {\cos (x)}{2-3 \sin (x)+\sin ^2(x)} \, dx=-\log (1-\sin (x))+\log (2-\sin (x)) \]

[Out]

-ln(1-sin(x))+ln(2-sin(x))

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 17, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.200, Rules used = {3339, 630, 31} \[ \int \frac {\cos (x)}{2-3 \sin (x)+\sin ^2(x)} \, dx=\log (2-\sin (x))-\log (1-\sin (x)) \]

[In]

Int[Cos[x]/(2 - 3*Sin[x] + Sin[x]^2),x]

[Out]

-Log[1 - Sin[x]] + Log[2 - Sin[x]]

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

Rule 630

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> With[{q = Rt[b^2 - 4*a*c, 2]}, Dist[c/q, Int[1/Simp
[b/2 - q/2 + c*x, x], x], x] - Dist[c/q, Int[1/Simp[b/2 + q/2 + c*x, x], x], x]] /; FreeQ[{a, b, c}, x] && NeQ
[b^2 - 4*a*c, 0] && PosQ[b^2 - 4*a*c] && PerfectSquareQ[b^2 - 4*a*c]

Rule 3339

Int[cos[(d_.) + (e_.)*(x_)]^(m_.)*((a_.) + (b_.)*((f_.)*sin[(d_.) + (e_.)*(x_)])^(n_.) + (c_.)*((f_.)*sin[(d_.
) + (e_.)*(x_)])^(n2_.))^(p_.), x_Symbol] :> Module[{g = FreeFactors[Sin[d + e*x], x]}, Dist[g/e, Subst[Int[(1
 - g^2*x^2)^((m - 1)/2)*(a + b*(f*g*x)^n + c*(f*g*x)^(2*n))^p, x], x, Sin[d + e*x]/g], x]] /; FreeQ[{a, b, c,
d, e, f, n, p}, x] && EqQ[n2, 2*n] && IntegerQ[(m - 1)/2]

Rubi steps \begin{align*} \text {integral}& = \text {Subst}\left (\int \frac {1}{2-3 x+x^2} \, dx,x,\sin (x)\right ) \\ & = \text {Subst}\left (\int \frac {1}{-2+x} \, dx,x,\sin (x)\right )-\text {Subst}\left (\int \frac {1}{-1+x} \, dx,x,\sin (x)\right ) \\ & = -\log (1-\sin (x))+\log (2-\sin (x)) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.11 (sec) , antiderivative size = 9, normalized size of antiderivative = 0.53 \[ \int \frac {\cos (x)}{2-3 \sin (x)+\sin ^2(x)} \, dx=2 \text {arctanh}(3-2 \sin (x)) \]

[In]

Integrate[Cos[x]/(2 - 3*Sin[x] + Sin[x]^2),x]

[Out]

2*ArcTanh[3 - 2*Sin[x]]

Maple [A] (verified)

Time = 0.40 (sec) , antiderivative size = 14, normalized size of antiderivative = 0.82

method result size
derivativedivides \(-\ln \left (\sin \left (x \right )-1\right )+\ln \left (\sin \left (x \right )-2\right )\) \(14\)
default \(-\ln \left (\sin \left (x \right )-1\right )+\ln \left (\sin \left (x \right )-2\right )\) \(14\)
norman \(-2 \ln \left (\tan \left (\frac {x}{2}\right )-1\right )+\ln \left (\tan ^{2}\left (\frac {x}{2}\right )-\tan \left (\frac {x}{2}\right )+1\right )\) \(26\)
parallelrisch \(-2 \ln \left (-\cot \left (x \right )+\csc \left (x \right )-1\right )+\ln \left (\frac {2-\sin \left (x \right )}{\cos \left (x \right )+1}\right )\) \(27\)
risch \(-2 \ln \left ({\mathrm e}^{i x}-i\right )+\ln \left (-4 i {\mathrm e}^{i x}+{\mathrm e}^{2 i x}-1\right )\) \(29\)

[In]

int(cos(x)/(2-3*sin(x)+sin(x)^2),x,method=_RETURNVERBOSE)

[Out]

-ln(sin(x)-1)+ln(sin(x)-2)

Fricas [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 17, normalized size of antiderivative = 1.00 \[ \int \frac {\cos (x)}{2-3 \sin (x)+\sin ^2(x)} \, dx=\log \left (-\frac {1}{2} \, \sin \left (x\right ) + 1\right ) - \log \left (-\sin \left (x\right ) + 1\right ) \]

[In]

integrate(cos(x)/(2-3*sin(x)+sin(x)^2),x, algorithm="fricas")

[Out]

log(-1/2*sin(x) + 1) - log(-sin(x) + 1)

Sympy [A] (verification not implemented)

Time = 0.09 (sec) , antiderivative size = 12, normalized size of antiderivative = 0.71 \[ \int \frac {\cos (x)}{2-3 \sin (x)+\sin ^2(x)} \, dx=\log {\left (\sin {\left (x \right )} - 2 \right )} - \log {\left (\sin {\left (x \right )} - 1 \right )} \]

[In]

integrate(cos(x)/(2-3*sin(x)+sin(x)**2),x)

[Out]

log(sin(x) - 2) - log(sin(x) - 1)

Maxima [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 13, normalized size of antiderivative = 0.76 \[ \int \frac {\cos (x)}{2-3 \sin (x)+\sin ^2(x)} \, dx=-\log \left (\sin \left (x\right ) - 1\right ) + \log \left (\sin \left (x\right ) - 2\right ) \]

[In]

integrate(cos(x)/(2-3*sin(x)+sin(x)^2),x, algorithm="maxima")

[Out]

-log(sin(x) - 1) + log(sin(x) - 2)

Giac [A] (verification not implemented)

none

Time = 0.38 (sec) , antiderivative size = 17, normalized size of antiderivative = 1.00 \[ \int \frac {\cos (x)}{2-3 \sin (x)+\sin ^2(x)} \, dx=\log \left (-\sin \left (x\right ) + 2\right ) - \log \left (-\sin \left (x\right ) + 1\right ) \]

[In]

integrate(cos(x)/(2-3*sin(x)+sin(x)^2),x, algorithm="giac")

[Out]

log(-sin(x) + 2) - log(-sin(x) + 1)

Mupad [B] (verification not implemented)

Time = 15.22 (sec) , antiderivative size = 9, normalized size of antiderivative = 0.53 \[ \int \frac {\cos (x)}{2-3 \sin (x)+\sin ^2(x)} \, dx=-2\,\mathrm {atanh}\left (2\,\sin \left (x\right )-3\right ) \]

[In]

int(cos(x)/(sin(x)^2 - 3*sin(x) + 2),x)

[Out]

-2*atanh(2*sin(x) - 3)